object test: Also test object type properties
authorChristian Dywan <christian@twotoasts.de>
Tue, 14 Oct 2008 12:33:00 +0000 (12:33 +0000)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 6 Jun 2016 02:15:00 +0000 (22:15 -0400)
Old patch found in bugzilla, it still applies and doesn't
cause the test to fail.

https://bugzilla.gnome.org/show_bug.cgi?id=556254

testsuite/gtk/object.c

index 2da5bdceb3dd0e5c0d6cf34ef32db1d6af0cf4cf..6bdcd7386402809fc7628b938feb776cdfa4dda3 100644 (file)
@@ -63,6 +63,7 @@ list_ignore_properties (gboolean buglist)
     { "GtkCellView",            "background",           (void*) "", },                  /* "" is not a valid background color */
     { "GtkColorButton",         "color",                (void*) NULL, },                /* not a valid boxed color */
     { "GtkInputDialog",         "has-separator",        (void*) MATCH_ANY_VALUE, },     /* property disabled */
+    { "GtkInvisible",           "screen",               (void*) MATCH_ANY_VALUE },      /* cannot create GdkScreen */
     { "GtkMessageDialog",       "has-separator",        (void*) MATCH_ANY_VALUE, },     /* property disabled */
     { "GtkFontSelectionDialog", "has-separator",        (void*) MATCH_ANY_VALUE, },     /* property disabled */
     { "GtkColorSelectionDialog","has-separator",        (void*) MATCH_ANY_VALUE, },     /* property disabled */
@@ -80,6 +81,8 @@ list_ignore_properties (gboolean buglist)
     { "GtkRecentChooserMenu",   "select-multiple",      (void*) MATCH_ANY_VALUE },      /* property disabled */
     { "GtkTextView",            "overwrite",            (void*) MATCH_ANY_VALUE },      /* needs text buffer */
     { "GtkToolbar",             "icon-size",            (void*) GTK_ICON_SIZE_INVALID },
+    { "GtkTreeView",            "expander-column",      (void*) MATCH_ANY_VALUE },      /* assertion list != NULL */
+    { "GtkWindow",              "screen",               (void*) MATCH_ANY_VALUE },      /* cannot create GdkScreen */
     { NULL, NULL, NULL }
   };
   /* properties suspected to be Gdk/Gtk+ bugs */
@@ -162,12 +165,27 @@ pspec_select_value (GParamSpec *pspec,
       else if (dvalue <= -1)
         g_value_set_flags (value, fspec->flags_class->values[g_test_rand_int_range (0, fspec->flags_class->n_values)].value);
     }
+  else if (G_IS_PARAM_SPEC_OBJECT (pspec))
+    {
+      gpointer object = NULL;
+      if (!G_TYPE_IS_ABSTRACT (pspec->value_type) &&
+          !G_TYPE_IS_INTERFACE (pspec->value_type))
+        {
+          if (g_type_is_a (pspec->value_type, GDK_TYPE_PIXBUF))
+            object = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 32, 32);
+          else if (g_type_is_a (pspec->value_type, GDK_TYPE_PIXBUF_ANIMATION))
+            object = gdk_pixbuf_simple_anim_new (32, 32, 15);
+          else
+            object = g_object_new (pspec->value_type, NULL);
+          g_object_ref_sink (object);
+          g_value_take_object (value, object);
+        }
+    }
   /* unimplemented:
    * G_IS_PARAM_SPEC_PARAM
    * G_IS_PARAM_SPEC_BOXED
    * G_IS_PARAM_SPEC_POINTER
    * G_IS_PARAM_SPEC_VALUE_ARRAY
-   * G_IS_PARAM_SPEC_OBJECT
    */
 }